package com.example.day07.ex02;

public class Student {
    String name;
    private int age;
    public void setAge(int a){
        if(a>=0 && a<=120){
            age = a;
        }else{
            System.out.println("年龄不合法");
        }
    }
    public int getAge(){
        return age;
    }
    public void show(){
        System.out.println("姓名："+name+",年龄："+age);
    }

}
